package com.cloudfun.campusshare.service;

import com.cloudfun.campusshare.common.model.dto.LoanDTO;
import com.cloudfun.campusshare.common.model.dto.LoanIssueDTO;
import com.cloudfun.campusshare.common.model.dto.LoanQueryDTO;
import com.cloudfun.campusshare.common.model.vo.*;
import com.cloudfun.campusshare.common.response.BaseResult;
import com.cloudfun.campusshare.common.response.PageResult;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * Created by Huqin on 2020/3/4
 */
public interface LoanService {

    /**
     * 创建
     *
     * @param loanDTO
     * @return
     */
    BaseResult<?> createDraft(LoanDTO loanDTO);

    /**
     * 提交申请
     *
     * @param loanDTO
     * @return
     */
    BaseResult<?> apply(LoanDTO loanDTO);

    /**
     * 详情
     *
     * @param loanId
     * @return
     */
    LoanVO detail(String loanId);


    /**
     * 融资贷款申请详情
     *
     * @param loanId
     * @return
     */
    LoanApplyDetailVO applyDetail(String loanId);

    /**
     * 删除
     *
     * @param loanId
     */
    void delete(String loanId);

    /**
     * 分页查询
     *
     * @param loanQueryDTO
     * @param pageable
     * @return
     */
    PageResult<LoanListVO> search(LoanQueryDTO loanQueryDTO, Pageable pageable);

    /**
     * 导出
     *
     * @param loanQueryDTO
     * @return
     */
    List<LoanFiExportVO> fiExport(LoanQueryDTO loanQueryDTO);

    /**
     * 导出
     *
     * @param loanQueryDTO
     * @return
     */
    List<BorrowerLoanAdminExportVO> adminExportBorrowerLoan(LoanQueryDTO loanQueryDTO);

    /**
     * 导出
     *
     * @param loanQueryDTO
     * @return
     */
    List<LenderLoanAdminExportVO> adminExportLenderLoan(LoanQueryDTO loanQueryDTO);

    /**
     * 导出
     *
     * @param ids
     * @param value
     * @value
     */
    List<LoanAdminExportVO> adminExport(List<String> ids, String value);

    /**
     * 查询已发放贷款总额
     *
     * @param userId
     * @return
     */
    String issuedLoanAmount(String userId);

    /**
     * 统计借款人数量
     *
     * @return
     */
    Long countBorrower();

    /**
     * 统计待审核数量
     *
     * @param userId
     * @return
     */
    Long countNeedAudit(String userId);

    /**
     * 统计已审核数量
     *
     * @return
     */
    Long countAudited();

    /**
     * 获取草稿
     *
     * @param loanId
     * @return
     */
    LoanDraftVO getDraft(String loanId);

    /**
     * 金融机构放款
     *
     * @param loanIssueDTO
     */
    void issueLoan(LoanIssueDTO loanIssueDTO);

    /**
     * 运营商确认收款
     *
     * @param loanId
     */
    void confirm(String loanId);
}
